"use strict";
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
  class SocietyApply extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
    }
  }
  SocietyApply.init(
    {
      personId: DataTypes.INTEGER,
      checkPerson: DataTypes.INTEGER,
      name: DataTypes.STRING,
      introduce: DataTypes.TEXT,
      type: DataTypes.INTEGER,
      planNum: DataTypes.INTEGER,
      publicizeUrl: DataTypes.STRING,
      reason: DataTypes.TEXT,
      status: DataTypes.INTEGER,
      applyType: DataTypes.INTEGER,
      attachment: DataTypes.STRING,
      remark: DataTypes.STRING,
    },
    {
      sequelize,
      modelName: "SocietyApply",
    }
  );
  SocietyApply.associate = function (models) {
    models.SocietyApply.belongsTo(models.User, {
      foreignKey: 'personId', // 本章表里面的id
      targetKey:'id'  // 
    });
  };
  return SocietyApply;
};
